# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=hash-extender
pkgver=161.f00b1a0
pkgrel=1
pkgdesc='A hash length extension attack tool.'
groups=('blackarch' 'blackarch-crypto')
arch=('x86_64' 'aarch64')
url='https://github.com/iagox86/hash_extender'
license=('BSD')
depends=('openssl')
makedepends=('git')
source=("$pkgname::git+https://github.com/iagox86/hash_extender.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|-D_BSD_SOURCE|-D_DEFAULT_SOURCE|' Makefile
}

build() {
  cd $pkgname

  make
}

package() {
  cd $pkgname

  install -Dm 755 hash_extender "$pkgdir/usr/bin/$pkgname"
  install -Dm 755 hash_extender_test "$pkgdir/usr/bin/hash-extender-test"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
}

